# Python sys.exc_info()方法：获取异常信息
import sys
try:
    x = int(input("请输入一个被除数："))
    print("30除以", x, "等于", 30 / x)
except:
    print(sys.exc_info())
    print("其他异常...")

print()

# 引入 traceback 模块
import traceback
try:
    x = int(input("请输入一个被除数："))
    print("30除以", x, "等于", 30 / x)
except:
    traceback.print_tb(sys.exc_info()[2])
    print("其他异常...")
